<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/session.php";
	require "includes/sql_functions.php";
	require "includes/scen_functions.php";
	
	oh_require_admin();
	
	render_header("Scenario Editor");
	
	$code=$_GET['code'];
	
	$scen=oh_fetch_scen_data($code);
	
	if($scen->code=="INVALID")
	{
		echo "Invalid scenario ".$code;
		die;
	}
	
	echo "<div style=\"display:inline-block;vertical-align:top;padding:0.5em\">";
	echo "<b>Edit scenario ".$code.":</b> ";
	
?>
	<br /><br />
	<form action="do_scenedit.php" method="POST">
		<input type="hidden" name="code" value="<?php echo $scen->code; ?>">
		
		System: <input type="text" name="system" size="12" class="inputbox" value="<?php echo $scen->system; ?>"><br /> 
			<span class="smalltext">The game's system, such as PFS, LFR, nWoD.</span><br /> <br /> 
		
		Title: <input type="text" name="title" size="64" class="inputbox" value="<?php echo $scen->title; ?>"> <br /> 
			<span class="smalltext">The Scenario's title.</span> <br /><br /> 
		
		Subtitle: <input type="text" name="subtitle" size="64" class="inputbox" value="<?php echo $scen->subtitle; ?>"> <br /> 
			<span class="smalltext">The Scenario's subtitle, leave blank if it has no subtitle.</span> <br /><br /> 
		
		Minimum Level: <input type="text" name="minlevel" size="3" class="inputbox" value="<?php echo $scen->minlevel; ?>"> <br /> 
			<span class="smalltext">Minimum allowed player level.</span> <br /><br /> 
		
		Maximum Level: <input type="text" name="maxlevel" size="3" class="inputbox" value="<?php echo $scen->maxlevel; ?>"> <br /> 
			<span class="smalltext">Maximum allowed player level.</span> <br /><br /> 
			
		Scenario Description: <br />
			<textarea name="desc" cols="50" rows="10" class="inputbox"><?php echo $scen->desc; ?></textarea></p>
		
		<input type="submit" class="button" value="Update Scenario"> <?php make_button("Cancel","scenarios.php"); ?>
		
	</form>
	</div>

<?php
	render_footer();
?>